package com.beyond.core.codec;

import java.util.List;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.socket.DatagramPacket;
import io.netty.handler.codec.MessageToMessageDecoder;
import io.netty.util.CharsetUtil;

public class MessageDecoder extends MessageToMessageDecoder<DatagramPacket> {	

	@Override
	protected void decode(ChannelHandlerContext ctx,  DatagramPacket datagramPacket, List<Object> list) throws Exception {
		  
	//	 datagramPacket.recipient().getAddress();
		 ByteBuf buf = datagramPacket.content();
         String msg = buf.toString(CharsetUtil.UTF_8);
         System.out.println(msg);
		 list.add(msg);
	}
}
